<!doctype html>
<html lang="">
<head>
  <meta charset="utf-8">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>st</title>

  <link rel="apple-touch-icon" href="apple-touch-icon.png">
  <!-- Place favicon.ico in the root directory -->

  <!-- build:css styles/vendor.css -->
  <!-- bower:css -->
  <link rel="stylesheet" href="/bower_components/datatables/media/css/dataTables.bootstrap.css" />
  <!-- endbower -->
  <!-- endbuild -->

  <!-- build:css styles/main.css -->
  <link rel="stylesheet" href="styles/main.css">
  <!-- endbuild -->

</head>
<body>
<!--[if IE]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
  your browser</a> to improve your experience.</p>
<![endif]-->

<div class="container">

  <div class="login-box">
    <!--<h2 style="margin-bottom: 20px">登录</h2>-->
    <form action="http://localhost/stu/auth" class="form-horizontal" role="form" method="post">
      <div class="form-group"><label class="sr-only" for="username">帐号</label>
        <div class="input-group">
          <div class="input-group-addon"><i class="glyphicon glyphicon-user"></i></div>
          <input type="password" class="form-control" id="username" name="username" placeholder="请输入帐号">
        </div>
      </div>
      <div class="form-group"><label class="sr-only" for="password">密码</label>
        <div class="input-group">
          <div class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></div>
          <input type="password" class="form-control" id="password" name="password" placeholder="请输入密码">
        </div>
      </div>
      <div class="form-group">
        <button type="submit" class="btn btn-primary btn-block">立即登陆</button>
      </div>
    </form>
  </div>
</div>


<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="/bower_components/jquery/dist/jquery.js"></script>
<script src="/bower_components/datatables/media/js/jquery.dataTables.js"></script>
<script src="/bower_components/datatables/media/js/dataTables.bootstrap.js"></script>
<script src="/bower_components/layer/src/layer.js"></script>
<!-- endbower -->
<!-- endbuild -->

<!-- build:js scripts/plugins.js -->
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/affix.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/alert.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/modal.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/transition.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/button.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/popover.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/carousel.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/scrollspy.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/collapse.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/tab.js"></script>
<!-- endbuild -->

<!-- build:js scripts/main.js -->
<script src="scripts/main.js"></script>
<!-- endbuild -->
<script>
  $('form').submit(function () {
     var postData= $(this).serializeArray();
    $.ajax({
      type: 'post',
      url: '/api/auth',
      data: postData,
      success: function (result) {
        if (result.code === 1) {
          layer.msg(result.info, {icon: 6}, function () {
            location.href = '/index.html'
          })
        } else {
          layer.msg(result.info, {icon: 5})
        }
      },
      dataType: 'json'
    });
    return false;
  })
</script>
</body>
</html>
